<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>用户列表</title>
    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
    </script>
    <script lang="javaScript">
        function delBlog(id) {
            $.ajax({
                type: "GET",
                url: "/blog/delBlog/" + id,
                data: "",//不需要传入数据就没传
                success: function (result) {
                    window.location.reload();
                }
            });
        }

        function modifyBlog(id) {
            window.location.href = "/blog/modifyBlogPage/" + id
        }
    </script>
</head>
<body style="background-color: grey">
<div align="center">
    <a href="/blog/addBlogPage">写博客</a><br><br><br>
</div>
<div th:each="blog : ${blogs}" style="background-color: white;width: 50%;margin: 0 auto">
    <p th:text="${blog.title}" style="font-weight: bold;font-size: 30px"></p>
    <p th:text="${blog.content}" style="font-size: 20px"></p>
    <button th:onclick="delBlog([[${blog.id}]]);">删除</button>
    <button th:onclick="modifyBlog([[${blog.id}]]);">编辑</button>
</div>

</body>
</html>
